<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>电子发票管理系统—修改密码</title>
<link href="../webjars/bootstrap/3.3.7-1/css/bootstrap.css" rel="stylesheet" type="text/css">
<link href="../webjars/bootstrap/3.3.7-1/css/bootstrap-theme.css" rel="stylesheet" type="text/css">
<script src="../static/jquery-easyui-1.5.5.3/jquery.min.js"></script>
<script src="../static/layer-v3.1.1/layer/layer.js"></script>
<script src="../webjars/bootstrap/3.3.7-1/js/bootstrap.js"></script>
<script type="text/javascript">
	function fun_tc(){
		layer.confirm("你确定退出吗？", {
			btn:['确定', '取消']
		}, function(){ 
			window.location.href="../logout1";
			layer.msg("已退出", {icon: 1});
		});
	}
	function fun(str){
		$.post('../pwd', {password: str}, function(data){
			if(! data){
				$("#pad-error").html("原密码输入错误");
			}else {
				$("#pad-error").html("");
			}
		});
	}
	$(function(){
		$("#btn_1").click(function(){
			var pad1 = $("#pad1").val();
			var pad2 = $("#pad2").val();
			var str = $("#pad").val();
			var f = false;
			if(str == "" || str == null){
				f = true;
				$("#pad-error").html("请输入原密码");
			}else if(pad1 == "" || pad1 == null){
				f = true;
				$("#pad1-error").html("请输入密码");
			}else if(pad2 == "" || pad2 == null){
				f = true;
				$("#pad1-error").html("");
				$("#pad2-error").html("请确认密码");
			}else if(pad1 != pad2){
				f = true;
				$("#pad1-error").html("");
				$("#pad2-error").html("两次密码不一致");
			}
			if(!f){
				$.post('../pwd', {password: str}, function(data){
					if(data){
						alert("修改成功！");
						window.parent.location="../xg?pad="+pad1;						
					}
				});
			}
		});
	});
</script>
<style type="text/css">
	*{
		margin: 0px;
		padding: 0px;
	}
	body{
		background: url(../static/img/beijin.jpg);
	}
	#home{
		margin-top: 91px;
	}
	#mytab li a{
		cursor: pointer;
	}
	.error{
		color: red;
	}
	#home_1{
		background: white;
		width: 70%;
		margin: 30px auto;
		padding: 20px 35px;
	}
</style>
</head>
<body>
	<nav class="navbar navbar-inverse navbar-fixed-top">
		<div class="container-fluid">
			<div class="navbar-header" style="margin-left: 50px;">
				<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#menu">
		        	<span class="sr-only">展开导航</span>
		            <span class="icon-bar"></span>
		            <span class="icon-bar"></span>
		            <span class="icon-bar"></span> 
		        </button>
				<a class="navbar-brand" href="">电子发票管理系统</a>
			</div>
			
			<div class="collapse navbar-collapse">
				<ul class="nav navbar-nav">
					<li>
						<a href="">
							欢迎您：
							<span sec:authorize="hasRole('ROLE_SYSTEM')"> 开发者 </span>
							<span sec:authorize="!hasRole('ROLE_SYSTEM')" sec:authentication="principal.name"></span>
						</a>
					</li>
				</ul>
			
				<ul class="nav navbar-nav navbar-right" id="mytab">
					<li><a href="../main1"><span class="glyphicon glyphicon-home"></span> 首页</a></li>
					<li class="active" sec:authorize="hasRole('ROLE_USER')"><a href=""><span class="glyphicon glyphicon-pencil"></span> 修改密码</a></li>
					<li sec:authorize="hasRole('ROLE_USER')"><a href="../invoice/all"><span class="glyphicon glyphicon-globe"></span> 电子发票管理</a></li>
					<li onclick="fun_tc()" sec:authorize="hasRole('ROLE_USER')"><a><span class="glyphicon glyphicon-off"></span> 注销</a></li>
					<li><a href=""></a></li>
					<li><a href=""></a></li>
				</ul>
			</div>
		</div>
	</nav>
	
	<div id="home">
		<div id="home_1">
			<ul class="breadcrumb">
				<li><span class="glyphicon glyphicon-home"></span>&emsp;当前位置：</li>
				<li><a class="active">修改密码</a></li>
			</ul>
			<div style="height: 320px;"><br>
				<form action="" method="post" class="col-md-6 col-md-offset-3">
					<div class="input-group">
						<span class="input-group-addon">请输入原密码：</span>
						<input type="password" class="form-control" id="pad" onchange="fun(this.value);" placeholder="原密码">
					</div>
					<div><label id="pad-error" class="error col-lg-offset-3" for="pad"></label></div><br>
					<div class="input-group">
						<span class="input-group-addon">请输入新密码：</span>
						<input type="password" class="form-control" id="pad1" placeholder="新密码">
					</div>
					<div><label id="pad1-error" class="error col-lg-offset-3" for="pad1"></label></div><br>
					<div class="input-group">
						<span class="input-group-addon">请确认新密码：</span>
						<input type="password" class="form-control" id="pad2" placeholder="确认密码">
					</div>
					<div><label id="pad2-error" class="error col-lg-offset-3" for="pad2"></label></div><br>
					<center><button type="button" id = "btn_1" class="btn btn-primary" style="width:200px;">确定</button></center>
				</form>
			</div>
		</div>
	</div>
</body>
</html>